package com.open.capacity.notice.dmo;

import java.io.Serializable;
import java.util.Objects;

import com.baomidou.mybatisplus.annotation.TableName;
import com.open.capacity.notice.dto.MessageTemplateDto;
import com.open.capacity.notice.enums.MsgType;

import io.swagger.annotations.ApiModelProperty;
import lombok.AccessLevel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * <p>
 * 消息模板
 * </p>
 * @since 2024-05-06
 */
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
@TableName("msg_template")
public class MessageTemplate extends AbstractSendEntity implements Serializable {

	private static final long serialVersionUID = 1L;

	@ApiModelProperty(value = "模板名称")
	private String name;

	@ApiModelProperty(value = "业务线")
	private String businessLines;

	@ApiModelProperty(value = "渠道类型")
	private String sendChannel;

	@ApiModelProperty(value = "模板内容")
	private String msgContent;

	@ApiModelProperty(value = "消息类型")
	@Setter(AccessLevel.PRIVATE)
	private MsgType msgType;

	public MessageTemplate(MessageTemplateDto messageTemplateDto) {
		if (Objects.nonNull(messageTemplateDto)) {
			setId(messageTemplateDto.getId());
			setName(messageTemplateDto.getName());
			setBusinessLines(messageTemplateDto.getBusinessLines());
			setSendChannel(messageTemplateDto.getSendChannel());
			setMsgContent(messageTemplateDto.getMsgContent());
			setMsgType(messageTemplateDto.getMsgType());
		}
	}

}
